<section class="vbox">
	<section class="scrollable padder">
		<section class="row m-b-md">
			<div class="col-sm-12">
				<h3 class="m-b-xs text-black">Danh sách conflict</h3>
			</div>
		</section>
		<div class="row">
			<div class="col-md-12">
				<form class="form-inline m-b-lg" method="GET" action="<?php echo base_url()?>companies/view/">
					<div class="form-group">
						<label>Tìm theo: </label>
						<input type="text" name="where" placeholder="tên/địa chỉ/số điện thoại" class="form-control" value="<?php echo @$_REQUEST["where"]; ?>">
					</div>

					<div class="form-group">
						<select class="form-control" name="comp_status">
							<option value="">Chọn tình trạng</option>
							<option value="0">Chưa xác nhận</option>
							<option value="1">Đã xác nhận</option>
							<option value="-2">Đang sử lý</option>
						</select>
					</div>
					<div class="form-group">
						<select class="form-control" name="comp_type">   
							<option value="">Chọn loại doanh nghiệp</option>                             
							<option value="1">Công Ty</option>
							<option value="0">Cá Nhân</option>
						</select>
					</div>
					<div class="form-group">
						<input type="submit" class="btn btn-primary" value="Tìm kiếm">
					</div>

				</form>

				<section class="panel b-a">
					<div class="panel-heading b-b"> <span class="badge bg-warning pull-right"><?php echo $this->data["count_page"]?></span>  <a href="#" class="font-bold">Danh sách khách hàng</a></div>
					<table class="table table-striped table-condensed table-hover table-bordered" id="list_company">
						<thead>
							<tr>
								<th>Tên khách hàng</th>
								<th>Địa chỉ</th>
								<th width="180px">Điện thoại</th>
								<th width="150px">Thông tin</th>
								<th width="100px">Tình trạng</th>
							</tr>
						</thead>
						<tbody>
							<?php 
							foreach($this->data["result"] as $num=>$val){
								$n=0;
								$array=array('comp_tax_code','comp_name','comp_address','comp_phone','comp_bank_account','comp_img_verify','comp_img_tax');
								foreach($array as $v){
									if($val[$v]!=""){
										$n+=1;
									}
								}
								
								$color="danger";
								$px=round($n/(count($array))*100);
								if($px>=100){
									$color="success";
								}else if($px>=50){
									$color="warning";
								}

								?>
								<tr>
								<td><a href="<?php echo base_url()?>companies/detail?id=<?php echo $val["comp_id"]?>"><?php echo $val["comp_name"]?></a></td>
									<td><a href="<?php echo base_url()?>companies/detail?id=<?php echo $val["comp_id"]?>"><?php echo $val["comp_address"]?></a></td>
									<td><a href="<?php echo base_url()?>companies/detail?id=<?php echo $val["comp_id"]?>"><?php echo $val["comp_phone"]?></a></td>
									<td>
										<div class="progress m-b-none progress-striped active">
										 <div class="progress-bar bg-<?php echo $color?>" data-toggle="tooltip" data-original-title="<?php echo $px?>%" style="width: <?php echo $px?>%"><?php echo $px?>%</div>
										 </div>
									</td>
									<td>
									<a href="<?php echo base_url()?>companies/detail?id=<?php echo $val["comp_id"]?>">
										<?php 
										if(isset($_GET['debug'])){
											echo '<span class="label bg-warning">Đang xử lý</span>';
										}else{
											if($val["comp_status"]==0){
												echo '<span class="label bg-danger">Chưa xác nhận1</span>';
											}else if($val["comp_status"]==-2){
												echo '<span class="label bg-warning">Đang xử lý</span>';
											}else if($val["comp_status"]==1){
												echo '<span class="label bg-success">Đã xác nhận</span>';
											}else{
												echo '<span class="label bg-danger">Chưa xác nhận</span>';
											}
										}

										?>

									</a>
									</td>
								</tr>
								<?php
							}
							?>
							

						</tbody>
						<tfoot>
							<tr>
								<td colspan="5" class="text-center">
									<ul class="pagination pagination">
									<?php 
										$config['base_url'] = base_url().'companies/view';
										$config['total_rows'] = $this->data["count_page"];
										$config['per_page'] = 10; 
										$config['full_tag_open'] = '<li>';
										$config['full_tag_close'] = '</li>';
										$config['last_tag_open'] = '<li>';
										$config['last_tag_close'] = '</li>';
										$config['next_tag_open'] = '<li>';
										$config['next_tag_close'] = '</li>';
										$config['prev_tag_open'] = '<li>';
										$config['prev_tag_close'] = '</li>';
										$config['cur_tag_open'] = '<li><a><b>';
										$config['cur_tag_close'] = '</b></a></li>';
										$config['num_tag_open'] = '<li>';
										$config['num_tag_close'] = '</li>';
										$this->pagination->initialize($config); 
										echo $this->pagination->create_links();
									?>
										
									</ul>
								</td>
							</tr>
						</tfoot>
					</table>
				</section>
			</div>
		</div>
	</section>
</section>

